home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / script-fu-util.scm < prev    next >
Encoding:
Text File  |  2009-08-19  |  1.6 KB  |  47 lines

  1. ; GIMP - The GNU Image Manipulation Program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; This program is free software: you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 3 of the License, or
  7. ; (at your option) any later version.
  8. ;
  9. ; This program is distributed in the hope that it will be useful,
  10. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ; GNU General Public License for more details.
  13. ;
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16.  
  17. ; Resizes the image so as to include the selected layer.
  18. ; The resulting image has the selected layer size.
  19. ; Copyright (C) 2002 Chauk-Mean PROUM
  20. ;
  21. (define (script-fu-util-image-resize-from-layer image layer)
  22.   (let* (
  23.         (width (car (gimp-drawable-width layer)))
  24.         (height (car (gimp-drawable-height layer)))
  25.         (posx (- (car (gimp-drawable-offsets layer))))
  26.         (posy (- (cadr (gimp-drawable-offsets layer))))
  27.         )
  28.  
  29.     (gimp-image-resize image width height posx posy)
  30.   )
  31. )
  32.  
  33. ; Add the specified layers to the image.
  34. ; The layers will be added in the given order below the
  35. ; active layer.
  36. ;
  37. (define (script-fu-util-image-add-layers image . layers)
  38.   (while (not (null? layers))
  39.     (let ((layer (car layers)))
  40.       (set! layers (cdr layers))
  41.       (gimp-image-add-layer image layer -1)
  42.       (gimp-image-lower-layer image layer)
  43.     )
  44.   )
  45. )
  46.  
  47.